﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using PBKVideo;

namespace PBKApplication
{
    public partial class PanelVideo : Panel
    {
        public PanelVideo(Video vid)
        {
            InitializeComponent();
            pictureBox1.LoadAsync(vid.UrlThumbnail);

            foreach (Control c in this.Controls)
            {
                c.MouseEnter += new System.EventHandler(this.PanelVideo_MouseEnter);
                c.MouseLeave += new System.EventHandler(this.PanelVideo_MouseLeave);
            }

            this.VideoInfo = vid;
            lblTitle.Text = vid.Title;
            lblDescription.Text = vid.Description;
            lblUploader.Text = vid.Uploader;
        }

        public Video VideoInfo
        {
            get;
            private set;
        }

        public PictureBox Thumbnail
        {
            get
            {
                return pictureBox1;
            }
        }

        public Point LocationPanel
        {
            get
            {
                return this.Location;
            }
            set
            {
                this.Location = value;
            }
        }

        private void PanelVideo_MouseEnter(object sender, EventArgs e)
        {
            Control c = sender as Control;
            if (c.Equals(this) || c.Parent.Equals(this))
            {
                this.BackColor = Color.SteelBlue;
                //Cursor = Cursors.Hand;
            }
        }

        private void PanelVideo_MouseLeave(object sender, EventArgs e)
        {
            //PanelVideo pv = sender as PanelVideo;
            Control c = sender as Control;
            if (c.Equals(this) || c.Parent.Equals(this))
            {
                this.BackColor = Color.Transparent;
                Cursor = Cursors.Default;
            }
        }

        private void PanelVideo_MouseClick(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {

            }
        }

    }
}
